﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CExample05_Sharp
{
    class  Polygon
    {
        protected int width, height;
        public void setValues(int a, int b)
        {
            width = a;
            height = b;
        }
        
    }
    class Rectangle : Polygon
    {
        public int area()
        {
            return (height * width);
        }
    }
    class Triangle : Polygon
    {
        public int area()
        {
            return (height * width / 2);
        }
    }
        class Program
        {
            static void Main(string[] args)
            {
                Rectangle recta = new Rectangle();
                Triangle trgl = new Triangle();
                recta.setValues(4, 5);
                trgl.setValues(4, 5);
                Console.WriteLine("recta:" + recta.area());
                Console.WriteLine("trgl:" + trgl.area());
            }
        }

}
